#include "elevator.h"

Elevator::Elevator(int id,int currentFloor,Direction direction)
    : id(id),currentFloor(currentFloor),targetFloor(currentFloor),direction(direction)
{

}

void Elevator::call(int floor)
{
    targetFloor = floor;
    if(targetFloor>currentFloor){
        direction = UP;
    }else if(targetFloor<currentFloor){
        direction = DOWN;
    }else{
        direction = IDLE;
    }
}

int Elevator::move()
{
    if(targetFloor>currentFloor){
        currentFloor++;
        direction = UP;
    }else if(targetFloor<currentFloor){
        currentFloor--;
        direction = DOWN;
    }else{
        direction = IDLE;
    }
    return currentFloor;
}



